function usuario()
{

    var user = document.getElementById("usernamesignup").value;
    var ema = document.getElementById("emailsignup").value;
    var pass = document.getElementById("passwordsignup").value;
    var confpass = document.getElementById("passwordsignup_confirm").value;
    
    if(user ==""  ||  ema== "" || pass== "" || confpass==""){
        alert("Faltan datos por completar");
        
    }else{
  
    if(pass != confpass){
        alert("Las contraseñas no coinciden");
        
    
    }else{
    
    if(validateEmail(ema)){
        
        
    //validaciones

    $.ajax
            ({
                type: "POST",
                url: "./php_registroUsuario.php",
                data:
                        {
                            req: "registroUsuario",
                            usuario: user,
                            email: ema,
                            password: pass
                            
                        },
                success: function(data)
                {
                    var json = jQuery.parseJSON(data);
                    if (json.succes)
                    {
                        alert("Success, " + json.msg + "  User: " + json.user);
                    }
                    else {
                        alert("Error al agregar");
                    }
                }
            });

}else{
    alert("Favor escriba un email valido")
}
}
}
}
;

function validateEmail(email) { 

  
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(email);
};

